import React, { Component } from 'react';
import DomHelper from './domHelper';

class Camera extends Component {
    constructor(props) {
        super(props);
        this.state = {
            loaded: false,
        };
    }

    componentDidMount() {
        this.camera = new THREE.PerspectiveCamera(45, DomHelper.width / DomHelper.height, 1, 10000);
        this.camera.position.set(0, 0, 1030);
        this.camera.lookAt(DomHelper.scene.position);
        DomHelper.scene.add(this.camera);
        DomHelper.camera = this.camera;
        DomHelper.update();
    }

    componentWillUnmount() {
        // DomHelper.camera.remove();
    }

    render() {
        return (
          <div className="threed-scene-camera"> 
            {this.props.children} 
          </div>
        )
    }
}

export default Camera;
